package com.demo.small_tool.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class MyCommandRunner implements CommandLineRunner {

    @Value("${spring.web.login_url}")
    private String loginUrl;
//    @Value("${spring.web.execute_path}")
//    private String executePath;
    @Value("${spring.web.auto_open}")
    private Boolean autoOpen;


    @Override
    public void run(String... args) throws Exception {
        String cmd = "cmd /t start " + loginUrl;
        if (autoOpen) {
            Runtime.getRuntime().exec(cmd);
        }
    }
}
